using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_PsdetMap : EntityTypeConfiguration<so_Psdet>
    {
        public so_PsdetMap()
        {
            // Primary Key
            this.HasKey(t => t.Date);

            // Properties
            this.Property(t => t.Invoice_Number)
                .HasMaxLength(8);

            this.Property(t => t.Currency)
                .HasMaxLength(5);

            this.Property(t => t.Document_Type)
                .HasMaxLength(7);

            this.Property(t => t.Item)
                .HasMaxLength(10);

            this.Property(t => t.Item_description)
                .HasMaxLength(250);

            this.Property(t => t.Customer__)
                .HasMaxLength(6);

            this.Property(t => t.Customer_Name)
                .HasMaxLength(110);

            this.Property(t => t.SALESMAN)
                .HasMaxLength(30);

            // Table & Column Mappings
            this.ToTable("so_Psdet");
            this.Property(t => t.Invoice_Number).HasColumnName("Invoice_Number");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.Currency).HasColumnName("Currency");
            this.Property(t => t.Total).HasColumnName("Total");
            this.Property(t => t.Invoice_Cost).HasColumnName("Invoice_Cost");
            this.Property(t => t.Returned_Money).HasColumnName("Returned_Money");
            this.Property(t => t.Document_Type).HasColumnName("Document_Type");
            this.Property(t => t.Discount_Amount).HasColumnName("Discount_Amount");
            this.Property(t => t.Total_Discounted_Invoice).HasColumnName("Total_Discounted_Invoice");
            this.Property(t => t.Item).HasColumnName("Item");
            this.Property(t => t.Item_description).HasColumnName("Item_description");
            this.Property(t => t.Item_Quantity).HasColumnName("Item_Quantity");
            this.Property(t => t.Total_Item_Amount).HasColumnName("Total_Item_Amount");
            this.Property(t => t.Item_Cost).HasColumnName("Item_Cost");
            this.Property(t => t.Item_Price).HasColumnName("Item_Price");
            this.Property(t => t.Item_Discount_Percentage).HasColumnName("Item_Discount_Percentage");
            this.Property(t => t.Discount_Value).HasColumnName("Discount_Value");
            this.Property(t => t.Discounted_Total_Item).HasColumnName("Discounted_Total_Item");
            this.Property(t => t.Expiry_Date).HasColumnName("Expiry_Date");
            this.Property(t => t.Customer__).HasColumnName("Customer_#");
            this.Property(t => t.Customer_Name).HasColumnName("Customer_Name");
            this.Property(t => t.SALESMAN).HasColumnName("SALESMAN");
            this.Property(t => t.Profit).HasColumnName("Profit");
            this.Property(t => t.Document_id).HasColumnName("Document_id");
        }
    }
}
